<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
    <style>
       #d1{
            width: 200px;
            height: 200px;
            box-sizing: border-box;
            padding: 20px;
            background-color: tomato;
        }
    </style>
</head>
<body>
<!--
键盘事件
 keyup
 keydown

 事件修饰符：
     1. 键盘事件修饰
       .enter
       .up
       .left
       .right
       ....
     2. 鼠标事件修饰符
            .top  阻止事件冒泡
            .self  只监听自己本身事件
            .once  事件一次有效
            .prevent  阻止事件的默认行为
-->
<div id="app">
    <input type="text" placeholder="请输入信息" @keyup.enter="showInfo">
    <input type="text" placeholder="请输入信息" @keydown.enter="showInfo2">
    <input type="text" placeholder="请输入信息" @keydown.up="showInfo3">
    <br>
    <div id="d1" @click.self="divCallBack">
        <button @click.once="btnCallback">单击按钮</button>
    </div>
    <a href="http://www.baidu.com" @click.prevent="aCallback">baidu</a>
</div>

<script>
    let vm = new Vue({
        el: '#app',
        data: {},
        methods: {
            showInfo() {
                console.log('keyup')
            },
            showInfo2() {
                console.log('keydown')
            },
            showInfo3() {
                console.log('up')
            },
            divCallBack(){
                console.log('div click')
            },
            btnCallback(){
                console.log('btn click')
            },
            aCallback(){
                console.log('A')
            }
        }
    })
</script>
</body>
</html>